package com.rocksdata.mc.ui.activity;

import android.os.Bundle;
import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.ctz.commonframe.ui.TitleBarActivity;
import com.ctz.commonframe.utils.GlideApp;
import com.rocksdata.mc.BuildConfig;
import com.rocksdata.mc.Config;
import com.rocksdata.mc.business.BusinessManager;
import com.rocksdata.mc.entity.AnnouncementInfo;
import com.rocksdata.mc.R;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;

/**
 * Created by 陈堂正 on 2017/4/27.
 */
@ContentView(R.layout.activity_notification_detail)
public class AnnouncementDetailActivity extends TitleBarActivity {
    @ViewInject(R.id.tv_title)
    private TextView tvTitle;
    @ViewInject(R.id.tv_date)
    private TextView tvDate;
    @ViewInject(R.id.tv_creator)
    private TextView tvCreator;
    @ViewInject(R.id.iv_pic)
    private ImageView ivPic;
    @ViewInject(R.id.tv_content)
    private TextView tvContent;

    private AnnouncementInfo info;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitleMiddleText("详情");
        info = (AnnouncementInfo) getIntent().getSerializableExtra("notification_info");
        BusinessManager.getAnnouncementManager().setRead(info.getNoticeCode());
        tvTitle.setText(info.getTitle());
        tvDate.setText(info.getPublishedTime());
        tvCreator.setText(info.getDepartmentName());
        tvContent.setText(info.getContent());
        if(!TextUtils.isEmpty(info.getVideoCoverPic())) {
            String picUrl = BuildConfig.HOST + info.getVideoCoverPic().substring(1);
//            XUtils3ImageDisplayer.display(ivPic, picUrl);
            GlideApp.with(this).load(picUrl).into(ivPic);
        }
    }
}
